<template>
    <div>
        <Timeline>
            <TimelineItem v-for="(diary,index) in diaryList" :key="index">
                <Card>
                    <div style="display: flex;justify-content: space-between">
                        <div>
                            <p style="margin-bottom: 10px" class="time">{{diary.dDiarytime}}</p>
                            <p class="content">{{diary.dcontent}}</p>
                        </div>
                        <div><img style="width: 180px;height: 100px" :src="diary.dpicture" alt=""></div>
                    </div>
                </Card>
            </TimelineItem>
        </Timeline>
    </div>
</template>

<script>
  export default {
    data () {
      return {
        diaryList: []
      }
    },
    mounted () {
      this.getDiaries()
    },
    methods: {
      getDiaries () {
        this.$http.get('diaries').then(res => {
          res = res.data
          if (res.code === 0) {
            this.diaryList = res.data
          } else {
            this.$Notice.error({ title: res.msg })
          }
        })
      }
    }
  }
</script>

<style scoped>

</style>
